/**
 * 运动员公示页面 - 搜索表单配置
 */

import type { FormItemRows } from '@meetjs/element-plus-kit'
import { useDict } from '@/composables/useDict'
import { SYSTEM_DICT, ATHLETE_DICT } from '@/constants/dictKeys'

// 使用 useDict hook 获取字典和组织级联数据
const { dicts, registerOrgOptions } = useDict([
	SYSTEM_DICT.SEX, // 性别
	ATHLETE_DICT.PROJECT // 注册项目
])

/**
 * 搜索表单配置
 */
export const searchFormConfig: FormItemRows[] = [
	{
		type: 'input',
		label: '姓名',
		prop: 'athleteName',
		col: 4,
		attrs: {
			placeholder: '请输入',
			clearable: true
		}
	},
	{
		type: 'select',
		label: '性别',
		prop: 'sex',
		col: 4,
		options: dicts[SYSTEM_DICT.SEX] as unknown as any,
		attrs: {
			placeholder: '请选择',
			clearable: true
		}
	},
	{
		type: 'date-picker',
		label: '公示月份',
		col: 4,
		prop: 'publicityTime',
		attrs: {
			type: 'month',
			placeholder: '请选择月份',
			format: 'YYYYMM',
			valueFormat: 'YYYYMM',
			clearable: true
			// disabledDate: (time: Date) => {
			// 	// 禁用大于当前月份的日期
			// 	return time.getTime() > new Date().getTime()
			// }
		}
	},
	{
		type: 'select',
		label: '注册项目',
		prop: 'projectId',
		col: 6,
		options: dicts[ATHLETE_DICT.PROJECT] as unknown as any
	},
	{
		type: 'cascader',
		label: '注册单位',
		col: 6,
		prop: 'orgId',
		options: registerOrgOptions as unknown as any,
		attrs: {
			placeholder: '请选择注册单位',
			'show-all-levels': false
		}
	}
]
